<?php
isset($_POST['token']) or exit("YOU DO NOT ACCESS THIS PAGE!!!");
require_once "lib/db.class.php";
$link = db::getInstance();
$link->conn->query('set names utf8');
extract($_POST);
$condition = array('start_city'=>$from,'end_city'=>$to,'weight'=>$weight);
$fields = array('min(FORMAT(inf,2)) as inf,max(FORMAT(sup,2)) as sup');
$res = $link->select('youhao',$condition,$fields);
if($res['inf'] == null && $res['sup'] == null){
	header("Location:../no_result.html");
}else{
	header("Location:../result.html?from=".$from."&to=".$to."&weight=".$weight."&res=".implode(',',$res));
	setcookie('from',$from,time()+3000);
	setcookie('to',$to,time()+3000);
	setcookie('weight',$weight,time()+3000);
	echo '<pre>';
	print_r($res);
}
$link->close();
